package io.renren.modules.sys.service.impl;

import com.alibaba.fastjson.JSON;
import io.renren.modules.sys.util.StringUtil;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.TiananSubmitDao;
import io.renren.modules.sys.entity.TiananSubmitEntity;
import io.renren.modules.sys.service.TiananSubmitService;

import javax.annotation.Resource;


@Service("tiananSubmitService")
public class TiananSubmitServiceImpl extends ServiceImpl<TiananSubmitDao, TiananSubmitEntity> implements TiananSubmitService {

    @Resource
    TiananSubmitDao tiananSubmitDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String tianid = "" + params.get("tianid");
        IPage<TiananSubmitEntity> page = this.page(
                new Query<TiananSubmitEntity>().getPage(params),
                new QueryWrapper<TiananSubmitEntity>()
                        .eq(StringUtil.isNotEmpty(tianid), "tianid", tianid)
                        .orderByDesc("id")

        );

        return new PageUtils(page);
    }

    @Override
    public List<TiananSubmitEntity> list(Map<String, Object> params) {
        String tianid = "" + params.get("tianid");


        return tiananSubmitDao.selectList(new QueryWrapper<TiananSubmitEntity>()
                .eq("banjiestatus", "-4")
                .eq(StringUtil.isNotEmpty(tianid), "tianid", tianid)
                .orderByDesc("id")
        );
    }

}
